// JavaScript Document

var flashvars = {};
var params = {menu:'false',allowScriptAccess:'always',quality:'high',wmode:'transparent'};
var attributes = {};

//swfobject.embedSWF("/en/swf/counter.swf", "counter", "672", "116", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/en/swf/talking.swf", "talk", "182", "138", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/en/swf/sponsors.swf", "sponsors", "630", "350", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
//swfobject.embedSWF("/en/swf/eventskv.swf", "eventskv", "740", "356", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/en/swf/video_player.swf", "video_player", "290", "216", "9.0.0", "expressInstall.swf", flashvars, params, attributes);

$(function() {
	$("nav ul li img").eq(num-1).fadeTo(500,0);
    $("nav ul li img").hover(
		function(){
			$(this).fadeTo(500,0);
		},
		function(){
		    var index = $("nav ul li img").index($(this));
			if(index == (num-1)){
		        return;
			}else{
				$(this).fadeTo(300,1);
		    }
		});

    $('.violet li:eq(3) dt').css('background-image', 'url(/en/images/leftbar_nav_coming.gif)');
    $('.violet li:eq(3) dt img').hover(function () { $(this).fadeTo(500, 0); }, function () { $(this).fadeTo(400, 1); });
    $('.violet li:eq(3) a').attr('href', 'javascript:;');

	$('header aside dl.language img,header aside dl.login img,header aside dl.logout img,header article .register img,section aside .app img,section aside #vote img,.content .back img').hover(function(){$(this).fadeTo(500,0);},function(){$(this).fadeTo(400,1);});

	$('section aside ul li').hover(function(){$(this).find('dl dd img').fadeTo(500,0);},function(){$(this).find('dl dd img').fadeTo(400,1);});

	$("header aside ul li a,header aside ol li a,footer ul li,.pressdetail .sns ol li,.sponsorsns ul li").each(function () {
        $(this).find("img").hover(
			function(){$(this).animate({padding:0,marginTop:-2,left:-50,top:-38},200)},
			function(){$(this).animate({padding:0,marginTop:0,left:0,top:0},200)}
		);
    });

    $('footer dl.link a')
		.css({ backgroundPosition: "0 0" })
		.mouseover(function () {
		    $(this).stop().animate({ backgroundPosition: "(-275px 0)" }, { duration: 500 })
		})
		.mouseout(function () {
		    $(this).stop().animate({ backgroundPosition: "(-550px 0)" }, { duration: 200, complete: function () {
		        $(this).css({ backgroundPosition: "0 0" })
		    } 
		    })
		});

	$('.content .lineback img').hover(function(){$(this).fadeTo(500,0);},function(){$(this).fadeTo(400,1);});

	$("#favoritelist li a").hover(function() {
        $(this).next("em").show();
	}, function() {
        $(this).next("em").hide();
    });

	$("#yellowtitle a").click(function(){
        $("#yellowcontent").slideToggle("slow");
        $(this).toggleClass("now");
        return false;
    });
	$("#bluetitle a").click(function(){
        $("#bluecontent").slideToggle("slow");
        $(this).toggleClass("now");
        return false;
    });


    $('#forgotpwd').click(function () {
        $.colorbox({
            href: "/en/forgot.html",
            width: 428,
            height: 283
        });
        return false;
    });
	$('ol.other li a:eq(2),.link .nav3 a,.regterms dd a').click(function(){
		$.colorbox({
			href:"/en/privacy.html", 
			width:610,
			height:605,
			onComplete:function(){
			    $('#privacy').jScrollPane({
			        verticalDragMinHeight: 50,
			        verticalDragMaxHeight: 50
			    });
			}
		});
		return false;
	});
    $("#sinalg").click(function () {
        var url = "https://api.weibo.com/oauth2/authorize?client_id=1509936684 &response_type=token&redirect_uri=http://www.uknow.org.cn/login_sina.html";
        window.open(url, "newlogin", "height=480,width=640");
    });
});

function popsaying() {
	$.colorbox({
		href:"/en/saying.html", 
		width:700,
		height:585
	});
}